package eu.connect.jmswrapper.callerproxies;

import java.io.Serializable;

import org.connect.enablers.discovery.repository.ConnectorInstance;
import org.connect.enablers.discovery.repository.ConnectorRepositoryInterface;
import org.connect.enablers.discovery.repository.ConnectorType;

import eu.connect.jmswrapper.*;

public class ConnectorRepositoryInterfaceJMSCallerProxy extends
		ConnectJMSCallerProxy implements ConnectorRepositoryInterface {

	@Override
	public void addConnector(ConnectorInstance arg0) {
		// TODO Auto-generated method stub
		ConnectJMSInvokeMessage jmsMsg = new ConnectJMSInvokeMessage();
		jmsMsg.setMethodName("addConnector");
		jmsMsg.setParameterTypes(new Class[]{ConnectorInstance.class});
		jmsMsg.setParameters(new Serializable[]{arg0});
		
		try {
			ConnectJMSSender sender = new ConnectJMSSender(jmsMsg,"ConnectorRepositoryInterface");
			sender.invoke();
			
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return;
	}

	@Override
	public ConnectorInstance getConnector(String arg0) {
		// TODO Auto-generated method stub
		ConnectJMSInvokeMessage jmsMsg = new ConnectJMSInvokeMessage();
		jmsMsg.setMethodName("getConnector");
		jmsMsg.setParameterTypes(new Class[]{String.class});
		jmsMsg.setParameters(new Serializable[]{arg0});
		
		try {
			ConnectJMSSender sender = new ConnectJMSSender(jmsMsg,"ConnectorRepositoryInterface");
			ConnectJMSReturnMessage returnMsg = sender.invoke();
			return (ConnectorInstance)returnMsg.getReturnObj();
			
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return null;
	}

	@Override
	public ConnectorInstance getConnector(String arg0, String arg1) {
		// TODO Auto-generated method stub
		ConnectJMSInvokeMessage jmsMsg = new ConnectJMSInvokeMessage();
		jmsMsg.setMethodName("getConnector");
		jmsMsg.setParameterTypes(new Class[]{String.class,String.class});
		jmsMsg.setParameters(new Serializable[]{arg0,arg1});
		
		try {
			ConnectJMSSender sender = new ConnectJMSSender(jmsMsg,"ConnectorRepositoryInterface");
			ConnectJMSReturnMessage returnMsg = sender.invoke();
			return (ConnectorInstance)returnMsg.getReturnObj();
			
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return null;
	}

	@Override
	public ConnectorType getConnectorType(String arg0, String arg1) {
		// TODO Auto-generated method stub
		ConnectJMSInvokeMessage jmsMsg = new ConnectJMSInvokeMessage();
		jmsMsg.setMethodName("getConnectorType");
		jmsMsg.setParameterTypes(new Class[]{String.class,String.class});
		jmsMsg.setParameters(new Serializable[]{arg0,arg1});
		
		try {
			ConnectJMSSender sender = new ConnectJMSSender(jmsMsg,"ConnectorRepositoryInterface");
			ConnectJMSReturnMessage returnMsg = sender.invoke();
			return (ConnectorType)returnMsg.getReturnObj();
			
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return null;
	}

}
